package prueba.PrimefacesSVN;

import java.io.Serializable;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;

import org.primefaces.event.DateSelectEvent;

@ManagedBean
@ViewScoped
public class Calendario implements Serializable {

	private static final long serialVersionUID = 8995118759276351827L;

	private Date date;

	public void cambioFecha(DateSelectEvent event) {
		DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");

		FacesContext.getCurrentInstance().addMessage(
				null,
				new FacesMessage("Fecha seleccionada: "
						+ formatter.format(event.getDate())));
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}
}